<?php

namespace Admin\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * MyApp\testBundle\Entity\Device
 *
 * @ORM\Table(name="device")
 * @ORM\Entity
 */
class Device
{
    /**
     * @var integer $iddevice
     *
     * @ORM\Column(name="iddevice", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $iddevice;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=true)
     */
    private $name;

    /**
     * @var string $phonenumber
     *
     * @ORM\Column(name="phonenumber", type="string", length=25, nullable=true)
     */
    private $phonenumber;

    /**
     * @var string $config
     *
     * @ORM\Column(name="config", type="text", nullable=true)
     */
    private $config;

    /**
     * @var boolean $state
     *
     * @ORM\Column(name="state", type="boolean", nullable=true)
     */
    private $state;

    /**
     * @var Type
     *
     * @ORM\OneToOne(targetEntity="Admin\Entity\Type")
     * @ORM\JoinColumn(name="type_idtype", referencedColumnName="idtype")
     */
    private $type;

    /**
     * @var User
     *
     * @ORM\ManyToOne(targetEntity="Admin\Entity\User", inversedBy="devices")
     * @ORM\JoinColumn(name="user_iduser", referencedColumnName="iduser")
     */
    private $user;    
    
    /**
     * @return Admin\Entity\Type
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @return Admin\Entity\User
     */
    public function getUser()
    {
        return $this->user;
    }

    public function toString()
    {
        echo $this->iddevice.' '.$this->name.'<br/>';
    }

    public function getIddevice() {
        return $this->iddevice;
    }

    public function setIddevice($iddevice) {
        $this->iddevice = $iddevice;
    }

    public function getName() {
        return $this->name;
    }

    public function setName($name) {
        $this->name = $name;
    }

    public function getPhonenumber() {
        return $this->phonenumber;
    }

    public function setPhonenumber($phonenumber) {
        $this->phonenumber = $phonenumber;
    }

    public function getConfig() {
        return $this->config;
    }

    public function setConfig($config) {
        $this->config = $config;
    }

    public function getState() {
        return $this->state;
    }

    public function setState($state) {
        $this->state = $state;
    }
}
